
import Cookies from 'js-cookie'

export function getCookie(name) {
	return Cookies.get(name)
}

export function setCookie(name,val,time) {
	var timeStr = "";
	if(time > 0){
		var date = new Date();
		var ms = time*3600*1000;
		date.setTime(date.getTime() + ms);
		timeStr = date;
	}
	if(time === Infinity){
		timeStr = new Date("Fri, 31 Dec 9999 23:59:59 GMT");
	}
	return Cookies.set(name, val,{
		expires: timeStr
	})
}

export function removeCookie(name) {
	return Cookies.remove(name)
}